import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import filter from './filter/filter'

Vue.config.productionTip = false
Vue.prototype.$ajax = axios

/**
 * axios拦截器
 */
axios.interceptors.request.use(function (config) {
    console.log("请求：", config)
    return config;
}, error => {
    console.log("请求异常")
});

axios.interceptors.response.use(function (response) {
    console.log("返回结果：", response)
    return response;
}, error => {
    console.log("响应结果异常")
})

// 全局过滤器
Object.keys(filter).forEach(key => {
    Vue.filter(key, filter[key])
});

new Vue({
    router,
    render: h => h(App),
}).$mount('#app')

console.log("环境：" + process.env.NODE_ENV)
console.log("配置环境为：" + process.env.VUE_APP_SERVER)
